namespace ContractorTimesheet.DataModel
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Data.Entity.Spatial;

    [Table("User")]
    public partial class User
    {
        public User() : this("", "", "", "", "", false, false, "", "") { }

        public User(string firstname, string lastname, string email, string po, string badgeNo, bool isAdmin, bool isActive, string password, string passwordSalt)
        {
            Firstname = firstname;
            Lastname = lastname;
            Email = email;
            PO = po;
            BadgeNo = badgeNo;
            IsAdmin = isAdmin;
            IsActive = isActive;
            Password = password;
            PasswordSalt = passwordSalt;
            Leaves = new HashSet<Leave>();
        }

        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        [Required]
        [StringLength(50)]
        public string Firstname { get; set; }

        [Required]
        [StringLength(50)]
        public string Lastname { get; set; }

        [Required]
        [StringLength(50)]
        public string Email { get; set; }

        [Required]
        [StringLength(50)]
        public string PO { get; set; }

        [Required]
        [StringLength(10)]
        public string BadgeNo { get; set; }

        public bool IsAdmin { get; set; }

        public bool IsActive { get; set; }

        //[DataType(DataType.Password)]
        [StringLength(200)]
        public string Password { get; set; }

        [StringLength(200)]
        public string PasswordSalt { get; set; }

        public string Username
        {
            get
            {
                return string.Format("{0}_{1}", Firstname, Lastname);
            }
        }

        public virtual ICollection<Leave> Leaves { get; set; }

    }
}
